package service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
//Scholar的架构
import entity.ScholarshipApplications;
import mapper.ScholarshipApplicationsMapper;
import service.ScholarshipApplicationsService;
import java.time.LocalDateTime;
import java.util.List;
@Service
public class ScholarshipApplicationsImpl implements ScholarshipApplicationsService {
    @Autowired
    private ScholarshipApplicationsMapper mapper;

    public ScholarshipApplications getById(Integer id) {
        return mapper.selectById(id);
    }

    public List<ScholarshipApplications> getAll() {
        return mapper.selectAll();
    }

    public List<ScholarshipApplications> getByStudentId(Integer sid) {
        return mapper.selectByStudentId(sid);
    }

    public int create(ScholarshipApplications a) {
        a.setCreatedAt(LocalDateTime.now());
        return mapper.insert(a);
    }

    public int update(ScholarshipApplications a) {
        a.setUpdatedAt(LocalDateTime.now());
        return mapper.update(a);
    }

    public int delete(Integer id) {
        return mapper.delete(id);
    }
}
